local plugins = {
{
  "Saghen/blink.cmp",
  opts = {
    completion = {
      menu = {
        draw = {
          padding = { 0, 1 }, -- padding only on right side
        },
      },
    },
  },
},
    {
        "folke/snacks.nvim",
        priority = 1000,
        lazy = false,
        init = function()
            vim.api.nvim_create_autocmd("User", {
                pattern = "OilActionsPost",
                callback = function(event)
                    if event.data.actions.type == "move" then
                        Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
                    end
                end,
            })
        end,
        keys = {
            { "<leader>bd", function() Snacks.bufdelete() end,       desc = "Buffer delete",       mode = "n" },
            { "<leader>ba", function() Snacks.bufdelete.all() end,   desc = "Buffer delete all",   mode = "n" },
            { "<leader>bo", function() Snacks.bufdelete.other() end, desc = "Buffer delete other", mode = "n" },
            { "<leader>bz", function() Snacks.zen() end,             desc = "Toggle Zen Mode",     mode = "n" },
        },
        opts = {
            bigfile = { enabled = true },
            --         dashboard = {
            --             preset = {
            --                 pick = nil,
            --                 ---@type snacks.dashboard.Item[]
            --                 keys = {
            --                     { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
            --                     { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" },
            --                     { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
            --                     { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" },
            --                     { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
            --                     { icon = " ", key = "s", desc = "Restore Session", section = "session" },
            --                     { icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil },
            --                     { icon = " ", key = "q", desc = "Quit", action = ":qa" },
            --                 },
            --                 header = [[
            --                                                   
            --            ████ ██████           █████      ██
            --           ███████████             █████ 
            --           █████████ ███████████████████ ███   ███████████
            --          █████████  ███    █████████████ █████ ██████████████
            --         █████████ ██████████ █████████ █████ █████ ████ █████
            --       ███████████ ███    ███ █████████ █████ █████ ████ █████
            --      ██████  █████████████████████ ████ █████ █████ ████ ██████
            --   ]],
            --             },
            --             sections = {
            --                 { section = 'header' },
            --                 {
            --                     section = "keys",
            --                     indent = 1,
            --                     padding = 1,
            --                 },
            --                 { section = 'recent_files', icon = ' ', title = 'Recent Files', indent = 3, padding = 2 },
            --                 { section = "startup" },
            --             },
            --         },
            explorer = { enabled = false },
            indent = { enabled = true },
            input = { enabled = false },
            picker = { enabled = false },
            notifier = { enabled = false },
            quickfile = { enabled = true },
            scope = { enabled = false },
            statuscolumn = { enabled = false },
            words = { enabled = false },
            rename = { enabled = true },
            zen = {
                enabled = true,
                toggles = {
                    ufo             = true,
                    dim             = true,
                    git_signs       = false,
                    diagnostics     = false,
                    line_number     = false,
                    relative_number = false,
                    signcolumn      = "no",
                    indent          = false
                }
            },
        },
        config = function(_, opts)
            require("snacks").setup(opts)

            Snacks.toggle.new({
                id = "ufo",
                name = "Enable/Disable ufo",
                get = function()
                    return require("ufo").inspect()
                end,
                set = function(state)
                    if state == nil then
                        require("noice").enable()
                        require("ufo").enable()
                        vim.o.foldenable = true
                        vim.o.foldcolumn = "1"
                    else
                        require("noice").disable()
                        require("ufo").disable()
                        vim.o.foldenable = false
                        vim.o.foldcolumn = "0"
                    end
                end,
            })
        end
    },
    {
        "lewis6991/gitsigns.nvim",
        opts = function()
            require "nvchad.configs.gitsigns"
        end,
        config = function(_, opts)
            require("scrollbar.handlers.gitsigns").setup()
            require("gitsigns").setup(opts)
        end,
    },
    {
        "nvim-tree/nvim-web-devicons",
        dependencies = {
            "rachartier/tiny-devicons-auto-colors.nvim",
        },

    },


    {
        "lukas-reineke/indent-blankline.nvim",
        main = "ibl",
        opts = {},
        config = function()
            require "configs.indent-blankline"
        end,

    },

    {
        "nvim-tree/nvim-tree.lua",
        -- enabled = false,
        dependencies = { "antosha417/nvim-lsp-file-operations" },
        opts = require "configs.tree",
        config = function(_, opts)
            require("nvim-tree").setup(opts)
            -- require("nvim-tree.diagnostics").update()
        end,
    },
    {
        "NvChad/nvim-colorizer.lua",
        enabled = false,
    },
    {
        "brenoprata10/nvim-highlight-colors",
        event = { "CursorHold", "CursorMoved" },
        opts = {
            render = "virtual",
            virtual_symbol = "󰏘",
            enable_named_colors = false,
            enable_tailwind = true,
            exclude_filetypes = { "lazy" },
        },
    },
    {
        "NStefan002/visual-surround.nvim",
        event = "BufEnter",
        config = function()
            require("visual-surround").setup {
                use_default_keymaps = false,
                exit_visual_mode = false,
            }
            local surround_chars = { "{", "[", "(", "'", '"', "<" }
            local surround = require("visual-surround").surround

            for _, key in pairs(surround_chars) do
                vim.keymap.set("v", "s" .. key, function()
                    surround(key)
                end, { desc = "[visual-surround] Surround selection with " .. key })
            end
        end,
    },

    {
        "L3MON4D3/LuaSnip",
        build = "make install_jsregexp",
        config = function(_, opts)
            require("luasnip").config.set_config(opts)
            require "nvchad.configs.luasnip"
            ---@diagnostic disable-next-line: different-requires
            require "configs.luasnip"
        end,
    },
    {
        "windwp/nvim-autopairs",
        config = function()
            require "configs.autopair"
        end,
    },

    {
        "OXY2DEV/helpview.nvim",
        event = "VeryLazy",
    },
    {
        "andrewferrier/debugprint.nvim",
        keys = { "<leader><leader>p" },
        config = function()
            require("debugprint").setup {
                create_keymaps = false,
                create_commands = false,
            }
        end,
    },
    {
        "aznhe21/actions-preview.nvim",
        event = "LspAttach",
        config = function()
            require("actions-preview").setup {
                diff = {
                    algorithm = "patience",
                    ignore_whitespace = true,
                },
                telescope = require("telescope.themes").get_dropdown { winblend = 10 },
            }
        end,
    },
    -- {
    --     "hiphish/rainbow-delimiters.nvim",
    --     event = "BufReadPost",
    --     config = function()
    --         local rainbow_delimiters = require "rainbow-delimiters"

    --         vim.g.rainbow_delimiters = {
    --             strategy = {
    --                 [""] = rainbow_delimiters.strategy["global"],
    --                 vim = rainbow_delimiters.strategy["local"],
    --             },
    --             query = {
    --                 [""] = "rainbow-delimiters",
    --                 lua = "rainbow-blocks",
    --             },
    --             highlight = {
    --                 "RainbowDelimiterRed",
    --                 "RainbowDelimiterYellow",
    --                 "RainbowDelimiterBlue",
    --                 "RainbowDelimiterOrange",
    --                 "RainbowDelimiterGreen",
    --                 "RainbowDelimiterViolet",
    --                 "RainbowDelimiterCyan",
    --             },
    --         }
    --     end,
    -- },
    {
        "gbprod/cutlass.nvim",
        event = "BufReadPost",
        opts = {
            cut_key = "x",
            override_del = true,
            exclude = {},
            registers = {
                select = "_",
                delete = "_",
                change = "_",
            },
        },
    },
    {
        "smoka7/multicursors.nvim",
        cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" },
        opts = {
            updatetime = 10,
            hint_config = false,
        },
        dependencies = {
            "smoka7/hydra.nvim",
        },
    },

    {
        "tzachar/local-highlight.nvim",
        event = { "CursorHold", "CursorHoldI" },
        opts = {
            hlgroup = "Visual",
        },
    },
    {
        "mistweaverco/kulala.nvim",
        ft = { "http" },
        opts = {
            inlay = {
                loading_icon = "",
                done_icon = "",
            },
        },
    },
    {
        "lukas-reineke/indent-blankline.nvim",
        main = "ibl",
        opts = {
            scope = { enabled = false },
        },
    },
    {
        "smoka7/hop.nvim",
        cmd = { "HopWord", "HopLine", "HopLineStart", "HopWordCurrentLine", "HopNodes" },
        config = function()
            require("hop").setup { keys = "etovxqpdygfblzhckisuran" }
        end,
    },
    {
        "nguyenvukhang/nvim-toggler",
        event = "BufReadPost",
        config = function()
            require("nvim-toggler").setup {
                remove_default_keybinds = true,
            }
        end,
    },
    {
        "echasnovski/mini.surround",
        event = { "ModeChanged" },
        ops = {},
    },
    {
        "petertriho/nvim-scrollbar",
        event = "WinScrolled",
        config = function()
            require "configs.scrollbar"
        end,
    },
    {
        "folke/todo-comments.nvim",
        event = "BufReadPost",
        config = function()
            require "configs.todo"
        end,
    },
    {
        "folke/trouble.nvim",
        ft = { "qf" },
        cmd = "Trouble",
        config = function()
            require("trouble").setup {
                modes = {
                    project_diagnostics = {
                        mode = "diagnostics",
                        filter = {
                            any = {
                                {
                                    function(item)
                                        return item.filename:find(vim.fn.getcwd(), 1, true)
                                    end,
                                },
                            },
                        },
                    },
                    mydiags = {
                        mode = "diagnostics",
                        filter = {
                            any = {
                                buf = 0,
                                {
                                    severity = vim.diagnostic.severity.ERROR,
                                    function(item)
                                        return item.filename:find(true, 1, (vim.loop or vim.uv).cwd())
                                    end,
                                },
                            },
                        },
                    },
                },
                auto_close = true,
                keys = {
                    ["<Esc>"] = "close",
                    ["<C-q>"] = "close",
                    ["<C-c>"] = "close",
                    ["R"] = "refresh",
                    ["<space>"] = "preview",
                    ["<cr>"] = "jump_close",
                    ["l"] = "fold_open",
                    ["h"] = "fold_close",
                    ["]"] = "next",
                    ["["] = "prev",
                    ["[["] = false,
                    ["]]"] = false,
                },
            }
        end,
    },
    {
        "b0o/schemastore.nvim",
        ft = { "json", "yaml", "yml" },
    },
    {
        "nvim-telescope/telescope-ui-select.nvim",
        event = "VeryLazy",
        config = function()
            require("telescope").load_extension "ui-select"
        end,
    },

    {
        "shellRaining/hlchunk.nvim",
        event = "BufReadPost",
        config = function()
            require "configs.hlchunk"
        end,
    },
    {
        "kdheepak/lazygit.nvim",
        cmd = "LazyGit",
    },
    {
        "BrunoKrugel/lazydocker.nvim",
        cmd = "LazyDocker",
    },
    {
        "BrunoKrugel/muren.nvim",
        cmd = "MurenToggle",
        config = true,
    },
    {
        "f-person/git-blame.nvim",
        cmd = "GitBlameToggle",
    },
    {
        "FabijanZulj/blame.nvim",
        cmd = "ToggleBlame",
    },
    {
        "akinsho/git-conflict.nvim",
        event = "VeryLazy",
        opts = {
            default_mappings = {
                ours = "<leader>gco",
                theirs = "<leader>gct",
                none = "<leader>gc0",
                both = "<leader>gcb",
                next = "]c",
                prev = "[c",
            },
            disable_diagnostics = true,
            list_opener = function()
                require("trouble").open "quickfix"
            end,
        },
    },

    {
        "luukvbaal/statuscol.nvim",
        lazy = false,
        config = function()
            require "configs.statuscol"
        end,
    },
    {
        "kcl-lang/kcl.nvim",
        init = function()
            vim.api.nvim_command([[autocmd BufRead,BufNewFile *.k set filetype=kcl]])
        end,
        ft = {
            "kcl",
        },
    },
    {
        "folke/noice.nvim",
        event = "VeryLazy",
        opts = {
            -- add any options here
        },
        dependencies = { { "MunifTanjim/nui.nvim" },
            { "rcarriga/nvim-notify" },
            { "nvim-lua/plenary.nvim" } },
    },
    {
        "nvim-telescope/telescope-media-files.nvim",
        lazy = true,
        config = function()
            require("telescope").setup {
                extensions = {
                    media_files = {
                        filetypes = { "png", "webp", "jpg", "jpeg" },
                    },
                    -- fd is needed
                },
            }
            require("telescope").load_extension "media_files"
        end,
    },

    -- 平滑滚动

    {
        "karb94/neoscroll.nvim",
        lazy = true,
        config = function()
            require("neoscroll").setup()
        end,

    },
    {
        "kevinhwang91/nvim-hlslens",
        event = "BufReadPost",
        config = function()
            require("hlslens").setup {
                build_position_cb = function(plist, _, _, _)
                    require("scrollbar.handlers.search").handler.show(plist.start_pos)
                end,
            }

            vim.cmd [[
          augroup scrollbar_search_hide
              autocmd!
              autocmd CmdlineLeave : lua require('scrollbar.handlers.search').handler.hide()
          augroup END
      ]]
        end,
    },
    -- 自动打开上次浏览位置

    { "farmergreg/vim-lastplace", lazy = true, },
    -- 历史修改记录
    {
        "mbbill/undotree",
        lazy = true,
        cmd = "UndotreeToggle",
    },
    -- 多光标
    {
        "mg979/vim-visual-multi",
        lazy = true,
        keys = "<A-n>",
    },
    -- 增删改引号
    {
        "tpope/vim-surround",
        lazy = true,
        keys = { "c", "d", "S" },
    },
    -- 快速选中
    {
        "gcmt/wildfire.vim",
        lazy = true,
        keys = "<CR>",
    },


    -- 快速分析启动时间
    {
        "dstein64/vim-startuptime",
        lazy = true,
        cmd = "StartupTime",
    },
    -- 编辑只读文件
    {
        "lambdalisue/suda.vim",
        lazy = true,
        cmd = "SudaWrite",
    },
    -- 现代任务系统
    {
        "skywind3000/asynctasks.vim",
        lazy = true,
        cmd = { "AsyncTask", "AsyncTaskEdit" },
    },
    -- markdown预览
    {
        "iamcco/markdown-preview.nvim",
        build = "cd app && bun install",
        ft = "markdown",
        init = function()
            vim.g.mkdp_filetypes = { "markdown" }
        end,
    },
    -- 制作markdown表格
    {
        "dhruvasagar/vim-table-mode",
        lazy = true,
        cmd = "TableModeToggle",
    },
    -- 自动切换输入法
    {
        "lilydjwg/fcitx.vim",
        lazy = true,
        keys = { 'i', 'a', 'I', 'A', 'c', 'o', 'O' },
    },
    ----------------------------------------- language plugins ------------------------------------------
    {
        "ray-x/go.nvim",
        ft = { "go", "gomod", "gosum", "gowork", "gotmpl" },
        dependencies = {
            {
                "ray-x/guihua.lua",
                build = "cd lua/fzy && make",
            },
        },
        config = function()
            require "configs.go"
        end,
        build = ':lua require("go.install").update_all_sync()',
    },
    {
        "pmizio/typescript-tools.nvim",
        ft = {
            "javascript",
            "typescript",
            "javascriptreact",
            "typescriptreact",
        },
        dependencies = {
            "dmmulroy/ts-error-translator.nvim",
        },
        config = function()
            require "configs.ts"
        end,
    },
    {
        "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
        event = "LspAttach",
        config = function()
            require("lsp_lines").setup()
        end,
    },
    {
        "BrunoKrugel/package-info.nvim",
        event = "BufEnter package.json",
        opts = {
            icons = {
                enable = true,
                style = {
                    up_to_date = "  ",
                    outdated = "  ",
                },
            },
            autostart = true,
            hide_up_to_date = true,
            hide_unstable_versions = true,
        },
    },
    {
        "nvim-neotest/neotest",
        ft = { "go", "javascript", "typescript", "javascriptreact", "typescriptreact" },
        dependencies = {
            "nvim-neotest/neotest-go",
            "nvim-neotest/nvim-nio",
        },
        config = function()
            ---@diagnostic disable-next-line: different-requires
            require "configs.neotest"
        end,
    },
    {
        "andythigpen/nvim-coverage",
        ft = { "go", "javascript", "typescript", "javascriptreact", "typescriptreact" },
        opts = {
            auto_reload = true,
            lang = {
                go = {
                    coverage_file = vim.fn.getcwd() .. "/coverage.out",
                },
            },
            signs = {
                covered = { hl = "CoverageCovered", text = "│" },
                uncovered = { hl = "CoverageUncovered", text = "│" },
            },
        },
    },


    {
        "sustech-data/wildfire.nvim",
        event = "VeryLazy",
        opts = {},
    },

    {
        "ThePrimeagen/refactoring.nvim",
        event = "BufRead",
        opts = {
            prompt_func_return_type = {
                go = true,
            },
            prompt_func_param_type = {
                go = true,
            },
        },
    },
    ----------------------------------------- completions plugins ------------------------------------------
    {
        "skywind3000/gutentags_plus",
        event = "VeryLazy",
        dependencies = { "ludovicchabant/vim-gutentags" },
        config = function()
            require "configs.tags"
        end,
    },



    {
        "simrat39/symbols-outline.nvim",
        dependencies = {
            "neovim/nvim-lspconfig",
        },
        keys = {
            { "<leader>s", "<cmd>SymbolsOutline<CR>", "n",
                { noremap = true, silent = true, desc = "SymbolsOutline" } } },
        config = function()
            require("symbols-outline").setup({
                highlight_hovered_item = true,
                show_guides = true,
                auto_preview = false,
                position = "right",
                relative_width = true,
                width = 25,
                auto_close = true,
                show_numbers = false,
                show_relative_numbers = false,
                show_symbol_details = true,
                preview_bg_highlight = "Pmenu",
                autofold_depth = nil,
                auto_unfold_hover = true,
                fold_markers = { "", "" },
                wrap = false,
                keymaps = {
                    -- These keymaps can be a string or a table for multiple keys
                    close = { "<Esc>", "q" },
                    goto_location = "<Cr>",
                    focus_location = "o",
                    hover_symbol = "<C-space>",
                    toggle_preview = "K",
                    rename_symbol = "r",
                    code_actions = "a",
                    fold = "h",
                    unfold = "l",
                    fold_all = "W",
                    unfold_all = "E",
                    fold_reset = "R",
                },
                lsp_blacklist = {},
                symbol_blacklist = {},
                symbols = {
                    File = { icon = "", hl = "TSURI" },
                    Module = { icon = "", hl = "TSNamespace" },
                    Namespace = { icon = "", hl = "TSNamespace" },
                    Package = { icon = "", hl = "TSNamespace" },
                    Class = { icon = "𝓒", hl = "TSType" },
                    Method = { icon = "ƒ", hl = "TSMethod" },
                    Property = { icon = "", hl = "TSMethod" },
                    Field = { icon = "", hl = "TSField" },
                    Constructor = { icon = "", hl = "TSConstructor" },
                    Enum = { icon = "ℰ", hl = "TSType" },
                    Interface = { icon = "ﰮ", hl = "TSType" },
                    Function = { icon = "", hl = "TSFunction" },
                    Variable = { icon = "", hl = "TSConstant" },
                    Constant = { icon = "", hl = "TSConstant" },
                    String = { icon = "𝓐", hl = "TSString" },
                    Number = { icon = "#", hl = "TSNumber" },
                    Boolean = { icon = "⊨", hl = "TSBoolean" },
                    Array = { icon = "", hl = "TSConstant" },
                    Object = { icon = "⦿", hl = "TSType" },
                    Key = { icon = "🔐", hl = "TSType" },
                    Null = { icon = "NULL", hl = "TSType" },
                    EnumMember = { icon = "", hl = "TSField" },
                    Struct = { icon = "𝓢", hl = "TSType" },
                    Event = { icon = "🗲", hl = "TSType" },
                    Operator = { icon = "+", hl = "TSOperator" },
                    TypeParameter = { icon = "𝙏", hl = "TSParameter" },
                },
            })
        end,
    },

    -- Install a plugin
    {
        "max397574/better-escape.nvim",
        event = "InsertEnter",
        config = function()
            require("better_escape").setup()
        end,
    },
    ----------------------------------------- completions plugins ------------------------------------------
    {
        "skywind3000/gutentags_plus",
        event = "VeryLazy",
        dependencies = { "ludovicchabant/vim-gutentags" },
        config = function()
            require "configs.tags"
        end,
    },
}


return plugins
